package com.etong.citymap.util;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;

import com.etong.citymap.bean.ScreenBean;

public class ActivityUtil {

	public static void ToActivity(Activity start, Class<?> end) {
		Intent intent = new Intent(start, end);
		//intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
		start.startActivity(intent);//.startActivity(intent);
	}
	
	public static void ToActivityForResult(Activity start, Class<?> end, Bundle bundle,int requestCode) {
		Intent intent = new Intent(start, end);
		//intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
		intent.putExtras(bundle);  
		start.startActivityForResult(intent, requestCode);//.startActivity(intent);
	}

	public static ScreenBean getScreenWidthAndHeight(Activity activity) {
		ScreenBean result=new ScreenBean();
		DisplayMetrics outMetrics = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
		result.setScreenHeight(outMetrics.heightPixels);
		result.setScreenWidth(outMetrics.widthPixels);
		return result;
	}

}
